/**@file   nivc.c
 * @brief
 * 
 * @author SealedGhost
 */
 
 
#include "misc.h"
#include "stm32f10x.h"
#include "stm32f10x_dma.h"



static void configPeriphNvic(IRQn_Type irq, uint16_t prePriority, uint16_t subPriority)
{
	NVIC_InitTypeDef nvicConfig;
	
	nvicConfig.NVIC_IRQChannel			= irq;
	nvicConfig.NVIC_IRQChannelPreemptionPriority	= prePriority;
	nvicConfig.NVIC_IRQChannelSubPriority			= subPriority;
	nvicConfig.NVIC_IRQChannelCmd					= ENABLE;
	NVIC_Init(&nvicConfig);	
}



void initNvic()
{

	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
	configPeriphNvic(USART1_IRQn, 0, 0);
	configPeriphNvic(USART3_IRQn, 1, 0);
	configPeriphNvic(TIM2_IRQn, 2, 0);
	
	//configPeriphNvic(DMA1_Channel5_IRQn, 0, 0);
}






